<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
/**
* 触发推送启动类
*/
class Runpush extends Controller
{
	
	//触发极光推送
	public function runJpush(){
		require $_SERVER['DOCUMENT_ROOT'] . '/vendor/' . 'JpushSend.class.php';	
		$user_mobile = [];
		$couriers = db('user')->where(['status'=>1,'check_status'=>1,'is_job'=>1])->select();//符合要求的配送员
		// dump($couriers);
		// file_put_contents('ii.txt',"\r\n"."ios",FILE_APPEND);
		if(!empty($couriers)){
			// foreach($couriers as $key => $val){
			// 	array_push($user_mobile,$val['mobile']);
			// }
			// dump($user_mobile);
			$user_mobile = array(15802035514,18813974748);
			// $receive['alias'] = $user_mobile;
			$receive = 'all';
			$chattitle = '待抢单消息';
			$content = '您有新的待抢单';
			$content = $chattitle . ":" . $content;
			$fetion = new \JpushSend();
			$m_type = 'paotui';
			$m_txt = '123';
			$m_time = 86400; //默认
			$res = $fetion->sendPub($receive, $content, $m_type, $m_txt, $m_time);
		}
		
		// return json(['status'=>1]);
	}


}